package com.ruoyi.ora.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ora.mapper.DeviceRelationMapper;
import com.ruoyi.ora.domain.DeviceRelation;
import com.ruoyi.ora.service.IDeviceRelationService;

/**
 * 设备关系Service业务层处理
 * 
 * @author liuwp
 * @date 2025-03-19
 */
@Service
public class DeviceRelationServiceImpl implements IDeviceRelationService 
{
    @Autowired
    private DeviceRelationMapper deviceRelationMapper;

    /**
     * 查询设备关系
     * 
     * @param id 设备关系主键
     * @return 设备关系
     */
    @Override
    public DeviceRelation selectDeviceRelationById(Long id)
    {
        return deviceRelationMapper.selectDeviceRelationById(id);
    }

    /**
     * 查询设备关系列表
     * 
     * @param deviceRelation 设备关系
     * @return 设备关系
     */
    @Override
    public List<DeviceRelation> selectDeviceRelationList(DeviceRelation deviceRelation)
    {
        return deviceRelationMapper.selectDeviceRelationList(deviceRelation);
    }

    /**
     * 根据业务主键查询一条记录：设备关系
     *
     * @param deviceRelation 设备关系
     * @return 设备关系
     */
    @Override
    public DeviceRelation selectOneDeviceRelation(DeviceRelation deviceRelation)
    {
        return deviceRelationMapper.selectOneDeviceRelation(deviceRelation);
    }

    /**
     * 新增设备关系
     * 
     * @param deviceRelation 设备关系
     * @return 结果
     */
    @Override
    public int insertDeviceRelation(DeviceRelation deviceRelation)
    {
        deviceRelation.setCreateTime(DateUtils.getNowDate());
        return deviceRelationMapper.insertDeviceRelation(deviceRelation);
    }

    /**
     * 修改设备关系
     * 
     * @param deviceRelation 设备关系
     * @return 结果
     */
    @Override
    public int updateDeviceRelation(DeviceRelation deviceRelation)
    {
        return deviceRelationMapper.updateDeviceRelation(deviceRelation);
    }

    @Override
    public int updateDeviceRelationCondition(DeviceRelation deviceRelation, DeviceRelation deviceRelationCondition)
    {
        return deviceRelationMapper.updateDeviceRelationCondition(deviceRelation, deviceRelationCondition);
    }

    /**
     * 批量删除设备关系
     * 
     * @param ids 需要删除的设备关系主键
     * @return 结果
     */
    @Override
    public int deleteDeviceRelationByIds(Long[] ids)
    {
        return deviceRelationMapper.deleteDeviceRelationByIds(ids);
    }

    /**
     * 删除设备关系信息
     * 
     * @param id 设备关系主键
     * @return 结果
     */
    @Override
    public int deleteDeviceRelationById(Long id)
    {
        return deviceRelationMapper.deleteDeviceRelationById(id);
    }

    /**
     * 条件删除设备关系
     *
     * @param deviceRelation 设备关系
     * @return 结果
     */
    @Override
    public int deleteDeviceRelationByCondition(DeviceRelation deviceRelation)
    {
        return deviceRelationMapper.deleteDeviceRelationByCondition(deviceRelation);
    }

}
